<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('noauth',function(){
    return view('errors.auth');
});


// 后台登录页面
Route::get('admin/login','Admin\LoginController@login');
Route::get('admin/test','Admin\LoginController@test');
// 验证码
Route::get('admin/yzm','Admin\LoginController@yzm');
// 登录数据提交
Route::post('admin/dologin','Admin\LoginController@dologin');

//测试加密的路由
// Route::get('admin/encrypt','Admin\LoginController@jiami');

// 后台首页路由
Route::group(['middleware'=>'islogin'],function(){
	//后台帖子管理
	Route::resource('/admin/anote', 'Admin\AnoteController');

	//后台分类管理
	Route::resource('/admin/amodule','Admin\AmoduleController');
	Route::get('admin/index','Admin\IndexController@index');

	Route::get('admin/user/auth/{id}','Admin\UserController@auth');
    Route::post('admin/user/doauth','Admin\UserController@doAuth');
	Route::resource('/admin/user','Admin\UserController');

	Route::resource('/home/user','Home\UserController');
	Route::post('/admin/editupload/{id}','Admin\AdvertController@editUpload');
	Route::post('/admin/upload','Admin\AdvertController@upload');
	Route::resource('/admin/advert','Admin\AdvertController');

	//角色管理模块
	//角色授权
	Route::get('admin/role/auth/{id}','Admin\RoleController@auth');
	Route::post('admin/role/doauth','Admin\RoleController@doAuth');
	Route::resource('/admin/role','Admin\RoleController');

	//    权限管理模块
	Route::resource('admin/permission','Admin\PermissionController');


// 退出登录
	Route::get('admin/logout','Admin\IndexController@logout');

});

//前台
Route::controller('/','Home\IndexController');






// Route::resource('/admin/user','admin\UserController');

